<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-store">
	<meta http-equiv="expires" content="0">  
	
	<link href="/static/jquery-easyui-1.5.3/themes/default/easyui.css" rel="stylesheet" />
    <link href="/static/jquery-easyui-1.5.3/themes/icon.css" rel="stylesheet" />
	<script type="text/javascript" src="/static/jquery-easyui-1.5.3/jquery.min.js" ></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.5.3/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="/static/js/date_format.js" ></script>

    <script type="text/javascript">
		//格式化级别
		function formatLevel(value,row,index){
			switch(value){
			case 0:
				return 'Emergency';
			case 1:
				return 'Alert';
			case 2:
				return 'Critical';
			case 3:
				return 'Error';
			case 4:
				return 'Warn';
			case 5:
				return 'Notice';
			case 6:
				return 'Info';
			case 7:
				return 'Debug';
			}
			return value;
		}
		
		//格式化时间
		function formatTime(value,row,index){
			return new Date(value * 1000).format('yyyy-mm-dd HH:MM:ss');
		}		

		//初始化信息
		$(function () {		
			var p = $('#dg').datagrid('getPager');  			
			$(p).pagination({  
				beforePageText: '第',
				afterPageText: '页    共 {pages} 页',  
				displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',  
			}); 
		});
    </script>
    <title>实时日志</title>	
<style type="text/css">
/*-- 消除grid屏闪问题 --//*/
.datagrid-mask{
  opacity:0;
  filter:alpha(opacity=0);
}
.datagrid-mask-msg{
  opacity:0;
  filter:alpha(opacity=0);
}
</style>
</head>
<body>
   <div style="width:100%; margin-left:auto; margin-right:auto;">  	
        <table width="100%" id="dg" class="easyui-datagrid" data-options="
			url:'/sys/logs',
			pagePosition:'top',
			pageSize:50,
			pageList:[10,20,50,100,200],
			rownumbers:true,
			singleSelect:true,
			singleSelect:true,
			autoRowHeight:false,
			pagination:true,
			resizeHandle:'right'
		">
		<thead>  
            <tr>
                <th width="15%" data-options="field:'Time',formatter:formatTime">时间</th>  
                <th width="5%" data-options="field:'Level',formatter:formatLevel">日志级别</th>  
                <th width="78%" data-options="field:'Msg'">消息</th>
            </tr>  
        </thead>  
        </table>  
    </div>  
</body>
</html>
